<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('sidebar.dataReport')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('serviceManage.crumbsOne')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('serviceManage.crumbsFive')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    
    <!-- -------------搜索查询栏------------------------ -->
      <search 
			:searchData="searchData" 
			@search="search" 
			@putExcel="putExcel" 
			:searchRight="true"
			:outputRight="$store.state.common.permiss.remindstatics.includes('export')"
    ></search>
    
    <!-- -------------表单显示栏------------------------ -->
    <div class="table">
       <el-table :data="tableData" size="small" :summary-method="getSummaries"
          show-summary>
          <el-table-column align="center" prop="dateTime" :label="$t('public.no87')" width="140">
          </el-table-column>
          <el-table-column align="center" prop="mustRefundTime" :label="$t('public.CreateTime')" width="140">
          </el-table-column>
          <el-table-column align="center" prop="servicerName" :label="$t('serviceManage.service')">
          </el-table-column>
            <el-table-column align="center" prop="remindType" :label="$t('add.no12')">
              <template slot-scope="scope">
                <span >{{$store.getters.serveStatus(scope.row.remindType)}}</span>
              </template>
            </el-table-column>
          <el-table-column align="center" prop="assignOrderCount" :label="$t('serviceManage.no1')">
          </el-table-column>
          <el-table-column align="center" prop="reminderOrderCount" :label="$t('serviceManage.no2')">
          </el-table-column>
          <template v-if="$store.state.common.lang==='vi'">
            <el-table-column align="center" prop="normalRepaidOrderCount" :label="$t('yuenan.no28')">
            </el-table-column>
            <el-table-column align="center" prop="overDueRepaidOrderCount" :label="$t('yuenan.no29')">
            </el-table-column>
          </template>
          <template v-else>
            <el-table-column align="center" prop="repaidOrderCount" :label="$t('serviceManage.no3')">
            </el-table-column>
          </template>
          <el-table-column align="center" prop="noRepaidOrderCount" :label="$t('serviceManage.no4')">
          </el-table-column>
        </el-table>
    </div>

    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>
    <div class="foot"></div>

  </div>
</template>
<script>
import putExcel from 'src/mixins/putExcel.js';//导出excel
import auditor from 'src/mixins/auditor.js';//获取app和aok
import getStage from 'src/mixins/getCustomerStage.js';//获取客服阶段
export default {
  name: 'peopleFirstAuditTotal',
  mixins:[putExcel,auditor,getStage],
  data () {
    const searchData=[
      {
        type: 'rangePicker',
        label: 'public.CreateTime',
        attr: 'searchTime1',
        value: [],
      },
      {
        type: 'rangePicker',
        label: 'public.no87',
        attr: 'searchTime2',
        value: [],
      },
      {
        type: 'select',
        attr: 'customerServicerId',
        label: 'serviceManage.service',
        option: [],
        value: '',
        langFlag: true,
      },
      {
        type: 'select',
        attr: 'remindType',
        label: 'add.no12',
        option: [],
        value: '',
        langFlag: true,
      }
    ]
    return {
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      flag: true,
      formInline: {
		customerServicerId: "",
		remindType: ""
      },
      options1: [], 
      tableData: [],// 列表数据模拟
      tableData1: [],// 列表数据模拟
      putExcelUrl:this.$action.remind_staticsExport
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
        this.formInline=search;
        this.formInline.mustRefundBeginTime=search.searchTime1?search.searchTime1[0]:'';
        this.formInline.mustRefundEndTime=search.searchTime1?search.searchTime1[1]:'';
        this.formInline.distributionBeginTime=search.searchTime2?search.searchTime2[0]:'';
        this.formInline.distributionEndTime=search.searchTime2?search.searchTime2[1]:'';
        if (this.flag) {
          this.flag = false;
          this.pagination.current = 1;
          this.getTableData();
        }
    },
    getTableData () { // 获取人工审核统计列表
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.remind_staticslist, option).then(res => {
        this.flag = true;
        if (res.code == 200) {
          this.tableData = res.data.list.list;
          this.tableData1 = res.data.count;
          this.pagination.total = res.data.list.total;
        }
      })
    },
    getSummaries() {// 总和
      let sums = [
          this.$t('public.addTotal'),
          '-',
          '-',
          '-',
          this.tableData1.assignOrderCount,
          this.tableData1.reminderOrderCount,
          this.tableData1.normalRepaidOrderCount,
          this.tableData1.overDueRepaidOrderCount,
          this.tableData1.noRepaidOrderCount,
        ]
      return sums;
    }
  },
  mounted () {
    this.getTableData();
    this.auditor().then(arr=>{
      this.searchData[2].option=arr;
    })
    this.getStage().then(arr=>{
      this.searchData[3].option=arr;
    })
    
  }
}
</script>
<style scoped lang="scss">

</style>
